package ControlLayer;

import ModelLayer.*;
import DBLayer.*;
import java.util.ArrayList;

public class CtrEmployee {
   
    
    /** Creates a new instance of CtrEmp */
    public CtrEmployee() {
        
    }
    
 
    public void insertNew(Employee empObj)
      {
           IFDBEmployee dbEmp = new DBEmployee();
           dbEmp.insertEmployee(empObj);
      }
    
    public ArrayList findAllEmployee()
    {
      IFDBEmployee dbEmp = new DBEmployee();
      ArrayList allEmp = new ArrayList();
      allEmp = dbEmp.getAllEmployee(false);
      return allEmp;
    }
      
        public Employee findEmployeebyID(int id)
    {
        IFDBEmployee dbEmp = new DBEmployee();
        return dbEmp.findEmployee( id, true);
    }
     
      public void updateEmp(int eId, String name, String adress, double salary, String startDate)
      {
          IFDBEmployee dbEmp = new DBEmployee();
          Employee emp = new Employee();
        
          emp.setName(name);
          emp.setAddress(adress);
          emp.setSalary(salary);
          emp.setStartDate(startDate);
          emp.setEmployeeID(eId);
          
          dbEmp.updateEmployee(emp);
     }
      //find the projects the employee is working on
    
      public Reservation findReservation(int resID)
      {
          IFDBReservation dbreserv = new DBReservation();
          Reservation result = dbreserv.findReservation(resID, true);
          return result;
      }  
      
      public ArrayList GetAllEmployee()
    {
      IFDBEmployee dbEmp = new DBEmployee();
      ArrayList allEmp = new ArrayList();
      allEmp = dbEmp.getAllEmployee(false);
      return allEmp;
    }
      
          public int getMaxID()
    {
        IFDBEmployee dbEmp = new DBEmployee();
        int id = dbEmp.MaxID();
        return id;
    }
      
      
         public int getAllMedarbejderNum()
   {
       IFDBEmployee dbEmp = new DBEmployee();
       int id = dbEmp.Antal();
       return id;
                
      }
          
}
